XdmModule.NativeModule<T> MethodXdmModule.NativeModule(Of T) MethodXdmModule::NativeModule<T> Method
Type Parameters
- T
The type that contains methods to expose.
Return Value
Type: XmlPrime.XdmModuleXmlPrime.XdmModuleXmlPrime::XdmModule^
A new instance of XdmModuleXdmModuleXdmModule containing functions representing methods from T.
Exceptions
Exception | Condition |
InvalidOperationExceptionInvalidOperationExceptionInvalidOperationException |
An InvalidOperationExceptionInvalidOperationExceptionInvalidOperationException is raised in the following conditions:
|
Remarks
For an example of the use of this function, see Modules.
Libraries of functions can be made available to an XQuery program, XPath expression or XSL transformation by adding them to the LibrariesLibrariesLibraries collection.
If T is annotated with the XdmModuleAttributeXdmModuleAttributeXdmModuleAttribute then the target
namespace can be specified by the attribute. If the attribute is not present, or the namespace is not
declared, then the namespace of the function library is a uri with the scheme clitype
. The
path of the URI is the full CLI name of the type.
Type | URI |
---|---|
MathMathMath | clitype:System.Math |
decimalDecimaldecimal | clitype:System.Decimal |
SpecialFolderSpecialFolderSpecialFolder |
clitype:System.Environment+SpecialFolder (note that this is an enumeration, and as such has no
static methods to import, but this still serves as an example of how to reference a nested type)
|
T must be a non-generic class, otherwise a NotSupportedExceptionNotSupportedExceptionNotSupportedException is thrown.
If T is annotated with the XdmModuleAttributeXdmModuleAttributeXdmModuleAttribute attribute, then all public static methods annotated with the XdmFunctionAttributeXdmFunctionAttributeXdmFunctionAttribute attribute are exported. The XdmFunctionAttributeXdmFunctionAttributeXdmFunctionAttribute attribute can be used to declare the local name of the exported function. If the XdmFunctionAttributeXdmFunctionAttributeXdmFunctionAttribute attribute does not declare a local name then the name of the method is used. If any public static method marked with the XdmFunctionAttributeXdmFunctionAttributeXdmFunctionAttribute attribute does not satisfy the conditions below then an InvalidOperationExceptionInvalidOperationExceptionInvalidOperationException is thrown.
If T is not annotated with the XdmModuleAttributeXdmModuleAttributeXdmModuleAttribute attribute then all the public static methods of T and its base types which satisfy all the following conditions are exposed. The methods are exported as functions with the same name as the method. Any XdmFunctionAttributeXdmFunctionAttributeXdmFunctionAttribute attributes are ignored.
- The method is public.
- The method is static.
- The method is not a generic method.
- The exported name of the method is a valid NCName value.
- The name of all the parameters are valid NCName values.
- The return type is supported.
- All the parameter types are supported.
- None of the parameters are ref or out parameters.
- None of the parameters are variable length argument lists.
- If the method is overloaded, then no overload has the same number of arguments.
If a method has the same exported name and number of arguments as a method in a base class, then the base class methods with the same name and number of arguments are excluded.